from django.test import TestCase

# Create your tests here.

import redis
import json


r = redis.Redis(decode_responses=True)
# print(r.keys())
#
# print(json.loads(r.get("shoppingcar_1_1")))

# re = r.keys("shoppingcar_1_*")
# print(re)
#
# print(json.loads(r.get(re[0])))

# print(json.loads(r.get("global_coupons_1")))
#
# print(json.loads(r.get("account_1_1")))



"""
    1.post接口创建数据结构
    {
        'title': 'Django课程',
        'img': 'https://hcdn1.luffycity.com/static/frontend/public_class/PY2@2x_1566529821.3087058.png',
        'relate_price_policy': {
            '4': {
                'pk': 4,
                'valid_period': 7,
                'valid_period_text': '1周',
                'price': 10.0,
                'default': False
            },
            '1': {
                'pk': 1,
                'valid_period': 14,
                'valid_period_text': '2周',
                'price': 30.0,
                'default': True
            },
            '5': {
                'pk': 5,
                'valid_period': 210,
                'valid_period_text': '12个月',
                'price': 12000.0,
                'default': False
            }
        },
        'choose_price_policy_id': 1,
        'price': 30.0,
        'valid_period': 14,
        'valid_period_text': '2周'
    }
"""


import hashlib

h = hashlib.sha256()

h.update(b"Hello")
print(h.hexdigest())

